#include "stdafx.h"
#include "inv_player.h"
#include "common.h"

// static void mergenibble( const unsigned char in_merge[] , unsigned char out_merge[] )
// {
// 	for ( int i = 0 ; i <= 15 ; i++ )
// 	{
// 		out_merge[i] = (in_merge[4*i+3]<<3)|(in_merge[4*i+2]<<2)|(in_merge[4*i+1]<<1)|(in_merge[4*i]) ;
// 	}
// }
void inv_player( const unsigned char in_invp[] , unsigned char out_invp[] )
{
	unsigned char tmp_invp[block_bits] ;
	const unsigned int p[block_bits] = {
		0 , 16 , 32 , 48 , 1 , 17 , 33 , 49 , 2 , 18 , 34 , 50 , 3 , 19 , 35 , 51 , 
		4 , 20 , 36 , 52 , 5 , 21 , 37 , 53 , 6 , 22 , 38 , 54 , 7 , 23 , 39 , 55 , 
		8 , 24 , 40 , 56 , 9 , 25 , 41 , 57 , 10 , 26 , 42 , 58 , 11 , 27 , 43 , 59 , 
		12 , 28 , 44 , 60 , 13 , 29 , 45 , 61 , 14 , 30 , 46 , 62 , 15 , 31 , 47 , 63 
	} ;
	for ( int i = 0 ; i < block_bits ; i++ )
	{
		tmp_invp[i] = in_invp[p[i]] ;
	}
	memcpy(out_invp, tmp_invp, block_bits);
/*	mergenibble( tmp_invp , out_invp ) ;*/
}